#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#===============================================================================
# Copyright 2011 zod.yslin
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# 
# Author: zod.yslin
# Email: 
# File Name: syntax_removed.py
# Description: 
#   1. PEP 3113 -- Removal of Tuple Parameter Unpacking
#   2. PEP 328 -- Imports: Multi-Line and Absolute/Relative
# Edit History: 
#   2011-10-25    File created.
#===============================================================================

#===============================================================================
#   1. PEP 3113 -- Removal of Tuple Parameter Unpacking
#      Python has very powerful introspection capabilities. 
#      These extend to function signatures. 
#===============================================================================

# only support 2.x
#def fxn(a, (b, c), d):
#    print(b, c)
#    pass
#fxn(1, (2,3), 4)

def fxn(a, b_c, d):
    b, c = b_c
    print(b, c)
    pass

fxn(1, (2,3), 4)


# only support 2.x
#def fxn((a, (b, c))):
#    print(a,b,c)
#    pass
#fxn((1,(2,3)))

def fxn(a_b_c):
    (a, (b, c)) = a_b_c
    print(a,b,c)
    pass

fxn((1,(2,3)))

def fxn(a_b_c):
    (a, b, c) = a_b_c
    print(a,b,c)
    pass

fxn((1,2,3))

# only support 2.x
#f = lambda (x, y): x + y
#print(f((1,2)))

f = lambda x_y: x_y[0] + x_y[1]
print(f((1,2)))

#===============================================================================
#   2. PEP 328 -- Imports: Multi-Line and Absolute/Relative
#      The only acceptable syntax for relative imports is from .[module] import name. 
#      All import forms not starting with . are interpreted as absolute imports. 
#===============================================================================

